package org.example;

/**
 * 主类
 * 用于测试装饰者模式的实现
 */
public class Main {
    public static void main(String[] args) {
        // 创建一个简单的咖啡
        Coffee coffee = new SimpleCoffee();
        System.out.println("1. 订单：" + coffee.getDescription());
        System.out.println("   价格：" + coffee.getCost() + "元");
        
        // 使用牛奶装饰者包装咖啡
        coffee = new MilkDecorator(coffee);
        System.out.println("\n2. 订单：" + coffee.getDescription());
        System.out.println("   价格：" + coffee.getCost() + "元");
        
        // 使用糖装饰者继续包装
        coffee = new SugarDecorator(coffee);
        System.out.println("\n3. 订单：" + coffee.getDescription());
        System.out.println("   价格：" + coffee.getCost() + "元");
        
        // 演示多重装饰：创建一个双份牛奶的咖啡
        Coffee doubleMilkCoffee = new MilkDecorator(new MilkDecorator(new SimpleCoffee()));
        System.out.println("\n4. 订单：" + doubleMilkCoffee.getDescription());
        System.out.println("   价格：" + doubleMilkCoffee.getCost() + "元");
    }
}